<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>XPM2 Examples</title>
<style>
body, pre {
	font-family: Verdana;
	font-size: 10pt;
}
</style>
</head>
<body bgcolor="#f1f3f5" topmargin="10" leftmargin="14">

<pre>
XPM2 SMTP & POP3 <b>Examples</b>
<hr>
<i>Notice</i>: XPM2 package contain a folder "EXAMPLES" with SMTP & POP3 simple and complex examples.

SMTP Example:
<table border="0" bgcolor="white">
<tr><td>
<pre><code>
// path to smtp.php from XPM2 package
require_once '/path/smtp.php';

$mail = new SMTP;
$mail->From('me@domain.com');
$mail->AddTo('client@destination.com');
$mail->Text('It is simple to use XPM2');
$sent = $mail->Send('Hello World!');

echo $sent ? 'Success' : 'Error';
</code></pre>
</td></tr>
</table>

POP3 Example:
<table border="0" bgcolor="white">
<tr><td>
<pre><code>
// path to pop3.php from XPM2 package
require_once '/path/pop3.php';

if($conn = POP3::Connect('mail.domain.com', 'username', 'password')){
	$stat = POP3::pStat($conn);
	if($stat[0] > 0){
		// get last mail
		$data = POP3::pRetr($conn, $stat[0]);
		POP3::pQuit($conn);
		echo $data ? $data : 'Error.';
	}else echo 'Mail is empty!';
}else echo 'Can not connect!';
</code></pre>
</td></tr>
</table>

<hr color="white">

[ <a style="color: blue; text-decoration: none" href="mailto:expertphp@gmail.com?subject=XPM2 Comment Examples">Comments</a> ]

Last update: Wednesday, June 28, 2006

</pre>

</body>
</html>